<template>
	<view class="flex justify-between" style="width: 100%;">
		<view class="flex align-center">
			<view @click="goToProfile" class="cu-avatar round" style="height: 96rpx; width: 96rpx;" :style="{'background-image':'url('+(isFan?followItem.userAvatar:followItem.followedUserAvatar)+')'}"></view>
			<view class="flex flex-direction" style="margin-left: 16rpx;">
				<text style="font-size: 32rpx; color: #333333; font-weight: bold;">{{isFan?followItem.userName:followItem.followedUserName}}</text>
				<text style="margin-top: 8rpx;font-size: 28rpx; color: #999999;">{{isFan?followItem.userFanCount:followItem.followedUserFanCount}}粉丝</text>
			</view>
		</view>
		<view class="flex align-center" @click="changeFollowState">
			<button v-if="type=='fan' && !followItem.isFollowMutually" class="flex align-center" style="width: 112rpx;height: 48rpx;background: #F2F2F7;">
				<text style="font-size: 26rpx; color: #007AFF;">关注</text>
			</button>
			<button v-if="type=='followee' && !followItem.isFollowMutually" class="flex justify-center align-center" style="width: 140rpx;height: 48rpx;background: #F2F2F7;">
				<text style="font-size: 26rpx; color: #999999">已关注</text>
			</button>
			<button v-if="followItem.isFollowMutually" class="flex justify-center align-center" style="width: 160rpx;height: 48rpx;background: #F2F2F7;">
				<text style="font-size: 26rpx; color: #999999">互相关注</text>
			</button>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				
			}
		},
		props: {
			followItem: Object,
			type: String
		},
		computed: {
			isFan() {
				return this.type == "fan";
			}
		},
		methods: {
			changeFollowState() {
				this.$emit('changeFollowState', this.followItem);
			},
			goToProfile() {
				let targetUserId = this.isFan ? this.followItem.userId : this.followItem.followedUserId;
				this.$Router.push({
					name:'profile',
					params: {
						authorId: targetUserId
					}
				})
			}
		}
	}
</script>

<style>
</style>
